<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8"
	%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'register.jsp' starting page</title>
<meta charset="utf-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="./css/vendor/bootstrap/css/bootstrap.min.css"
	rel="stylesheet">
<link href="./css/flat-ui.min.css" rel="stylesheet">
<link href="./css/style.min.css" rel="stylesheet">
 <!-- 
 <script type="text/javascript">
	 function validate() {

	    var pwd = $("#password").val();
	    var pwd1 = $("#password1").val();
	    if(pwd == pwd1)
	     {
	        $("#tishi4").html("两次密码相同");
	         $("#tishi4").css("color","green");
	    	$("#but").show();   
	     }
	else {
	        $("#tishi4").html("两次密码不相同");
	         $("#tishi4").css("color","red");
	          $("#but").hide();   
	      }
	}
	
	function isNum(){
		var phone=$("#phone").val();
		var nphone = parseInt(phone);//如果变量val是字符类型的数则转换为int类型 如果不是则ival为NaN
	    if(isNaN(nphone)){
	        $("#tishi3").html("请输入正确的手机号码格式");
	        $("#tishi3").css("color","red");
	        $("#phone").val("");
	    }else if(phone.toString().length != 11){
	    	$("#tishi3").html("请输入正确的手机号码格式");
	    	  $("#tishi3").css("color","red");
	        $("#phone").val("");
	    }else{
		$("#tishi3").html("");
		}
	}
	
	function isUsername(){
		var username=$("#username").val();
		var reg = /^[0-9a-zA-Z\u4e00-\u9fa5]+$/
		
		if(!reg.test(username)){
		$("#tishi1").html("您输入的名字中有非法符号\n如空格,下划线,@,#,$,^,&,*等");
	    $("#tishi1").css("color","red");
	    $("#username").val("");
		}else{
		$("#tishi1").html("");
		}
	}
	
	function isName(){
		var name=$("#name").val();
		var reg = /^[\u4e00-\u9fa5]+$/;
		
		if(!reg.test(name)){
		$("#tishi2").html("请输入您的真实姓名^_^");
	    $("#tishi2").css("color","red");
	    $("#name").val("");
		}else{
		$("#tishi2").html("");
		}
	} 
</script>
    -->
<script src="./js/registerCheck.js"></script>
<script src="./js/sms.js"></script>

</head>

<body>
	<div style="height:10px;"></div>
	<div class="container">
		<div style="width:100%;margin: 0 auto;background-color: #ffffff">
		<div id="reg" class="container" style="width:100%;">
			<h3 style="text-align: center;">
				欢迎注册
				</h1>
				<form action="servlet/register" method="post" name="form1" onSubmit="return myCheck()">
					<div class="form-group">
					          用户名<input id="username" name="username"type="text" class="form-control"
							placeholder="给自己取个好听的名字吧！" onBlur="checkusername()"><span id="usernameTip"></span><br> 
						您的姓名<input id="name" name="name" type="text" class="form-control"
							placeholder="真实姓名" onBlur="checkname()"><span id="nameTip"></span><br> 
						手机号码
						<div class="input-group">
							<input id="phone" name="phone" type="text" class="form-control" placeholder="手机号码"  onBlur="checkjbPhone()">
							  
							<span class="input-group-btn">
							<input type="button" class="sbtn sbtn-black" id="btnSendCode" onclick="sendMessage()" value="获取验证码">
							</span>
						</div>
						<span id="jbPhoneTip"></span><br/>
							
						短信验证码<input id="SmsCheckCode" name="SmsCheckCode"
							type="text" class="form-control" onBlur="CodeCheck()"><span id="SmsCheckCodeTip"></span><br>
						<span id="SmsCheckCodeTip"></span>
						 密码<input id="password" name="password"
							type="password" class="form-control" placeholder="至少6位字符" onBlur="checkpassword()"><span id="passwordTip"></span><br>
							 确认密码<input id="passwordRepeat" name="passwordRepeat"
							type="password" class="form-control" placeholder="输入与上相同密码" onBlur="checkpasswrodb()"><span id="passwordRepeatTip"></span>
							<br>
						地址*（不填收不到礼物哦）<input type="text" id="address" name="address" 
						class="form-control" placeholder="辽宁省大连市高新园区大连海事大学凌水路xx公寓xxxx号" onBlur="addCheck()"><span id="addressTip"></span><br>
						<label class="checkbox" for="agreement">
						 <input type="checkbox" checked="checked" id="ch" data-toggle="checkbox">
							我已阅读并同意网站的<a href="#">使用条件</a>及<a href="#">隐私声明</a>
						</label>
						<button class="sbtn sbtn-red" id="but" disabled="disabled" style="width: 100%;" color="gray" > 注册</button>
					</div>
				</form>
		</div>
	</div>
	</div>
	<div style="height: 65px;"></div>
	<footer style="width:100%;display:block;background-color: #eceeed;color: #868383;">
		<div>Copyright &copy; 2017</div>
	</footer>

	<script src="./js/jquery.min.js"></script>
	<script src="./js/flat-ui.min.js"></script>
	<script src="./js/script.js"></script>
	 <script>
        /*function check(){
            var checkbox = document.getElementById("ch");//选中checkbox的id；
            if(checkbox.checked==true){//按钮已选中
                document.getElementById("but").style.backgroundColor="red";
                document.getElementById("but").removeAttribute("disabled");//移除disabled
            }else{
                document.getElementById("but").style.backgroundColor="gray";
                document.getElementById("but").disadled="disabled";
            }
        }*/
        $('#ch').on('click', function(e){
        	if(e.target.checked){
        		$('#but').addClass('sbtn-red').removeAttr('disabled');
        	}else{
        		$('#but').removeClass('sbtn-red').attr('disabled', 'disabled');
        	}
        });
    </script>
</body>
</html>
